<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored ="false"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title>北京市电子行政监察平台-角色详细信息</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link href="<%=path%>/css/base.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/jquery-tree-1.1.css" rel="stylesheet" type="text/css" />
		<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
			var path = "<%=path%>";
		</script>
		<script type="text/javascript" src="<%=path%>/javascript/core/jquery-1.6.1.min.js"></script>
		<script type="text/javascript" src="<%=path%>/javascript/system/jquery-tree-1.1.js"></script>
		<script type="text/javascript">
		var treeData = "${permissionTree}";
		var tree;
		$(function () {
			//生成权限树
			tree = new $.Tree({
				parent: $("#authSetup"),
				source: $.parseJSON(treeData),
				allOpen: true,
				autoBlur: true,
				pretreatment: function (node) {
					node.id = node.permissionId + "_" + node.userOrRolePermissionVersion;
					delete node.userOrRolePermissionVersion;
					node.content = node.permissionName;
					delete node.permissionName;
					node.children = node.childPermissionDTOs;
					delete node.childPermissionDTOs;
					if(node.children && node.children.length <= 0)
						delete node.children;
					switch(node.permissionTypeFlag)
					{
					case "0":
						node.content = "<span class='system'>" + node.content + "</span>";
						switch(node.permissionStatus) 
						{
						case "0":
							node.content += "<span class='state system-unspecitied unspecitied type-system'>(未指定)</span>";
							break;
						case "1":
							node.content += "<span class='state system-show show type-system'>(可见)</span>";
							break;
						case "2":
							node.content += "<span class='state system-hide hide type-system'>(不可见)</span>";
							break;
						}
						break;
					case "1":
						node.content = "<span class='auth'>" + node.content + "</span>";
						switch(node.permissionStatus)
						{
						case "0":
							node.content += "<span class='state auth-unspecitied unspecitied type-auth'>(未指定)</span>";
							break;
						case "1":
							node.content += "<span class='state auth-enabled enabled type-auth'>(允许)</span>";
							break;
						case "2":
							node.content += "<span class='state auth-disabled disabled type-auth'>(禁止)</span>";
							break;
						}
						break;
					}
				}
			});
		});
		</script>
		<style type="text/css">
			div {
				position: static;
			}
		</style>
	</head>
	<body>
		<div class="right pop-window-content">
			<div class="right-all-content">
				<div class="inner-dialog">
					<h1 class="inner-dialog-title">角色详细信息</h1>
					<div class="inner-dialog-content">
					<s:if test="role==nulll">你所查找的角色已被删除，请更新页面</s:if>
					<s:else>
						<table class="inner-dialog-content-table new">
							<tbody>
								<tr>
									<td valign="top" style="text-align: right;">
										<span class="detail-feild">角 色 名:</span>
									</td>
									<td>
										<s:property value="role.roleName" />
									</td>
								</tr>
								<tr>
									<td valign="top" style="text-align: right;">
										<span class="detail-feild">描　　述:</span>
									</td>
									<td valign="top">
										<s:property value="role.roleNote" />
									</td>
								</tr>
								<tr>
									<td valign="top" style="text-align: right;">
										<span class="detail-feild">关联账号:</span>
									</td>
									<td valign="top">
									<s:if test="role.userAccountDTOs.size==0">无</s:if>
									<s:else>
										<table class="data-table" cellspacing="0">
												<thead>
													<tr>
														<th class="data-head">账号名</th>
														<th class="data-head">姓名</th>
														<th class="data-head">创建时间</th>
														<th class="data-head">状态</th>
														<th class="data-head">描述</th>
													</tr>
												</thead>
												<tbody>
													<s:iterator value="role.userAccountDTOs" id="userAccount"
														status="statu">
														<s:if test="#statu.odd">
															<s:if test="#statu.last">
																<tr class="odd last">
																	<td><s:property value="#userAccount.userAccountName" /></td>
																	<td><s:property value="#userAccount.userInfoDTO.userName" /></td>
																	<td><s:date name="#userAccount.createTime" format="yyyy-MM-dd"/></td>
																	<s:if test="#userAccount.userAccountIsEnabled==1"><td>启用</td></s:if>
																	<s:else><td>禁用</td></s:else>
																	<s:if test="#userAccount.userAccountNote==null || userAccount.userAccountNote==''"><td>&nbsp;</td></s:if>
																	<s:else><td><s:property value="#userAccount.userAccountNote" /></td></s:else>
																</tr>
															</s:if>
															<s:else>
																<tr class="odd" >
																	<td><s:property value="#userAccount.userAccountName" /></td>
																	<td><s:property value="#userAccount.userInfoDTO.userName" /></td>
																	<td><s:date name="#userAccount.createTime" format="yyyy-MM-dd"/></td>
																	<s:if test="#userAccount.userAccountIsEnabled==1"><td>启用</td></s:if>
																	<s:else><td>禁用</td></s:else>
																	<s:if test="#userAccount.userAccountNote==null || userAccount.userAccountNote==''"><td>&nbsp;</td></s:if>
																	<s:else><td><s:property value="#userAccount.userAccountNote" /></td></s:else>
																</tr>
															</s:else>
														</s:if>
														<s:elseif test="#statu.even">
							
															<s:if test="#statu.last">
																<tr class="even last" >
																	<td><s:property value="#userAccount.userAccountName" /></td>
																	<td><s:property value="#userAccount.userInfoDTO.userName" /></td>
																	<td><s:date name="#userAccount.createTime" format="yyyy-MM-dd"/></td>
																	<s:if test="#userAccount.userAccountIsEnabled==1"><td>启用</td></s:if>
																	<s:else><td>禁用</td></s:else>
																	<s:if test="#userAccount.userAccountNote==null || userAccount.userAccountNote==''"><td>&nbsp;</td></s:if>
																	<s:else><td><s:property value="#userAccount.userAccountNote" /></td></s:else>
																</tr>
															</s:if>
															<s:else>
																<tr class="even" >
																	<td><s:property value="#userAccount.userAccountName" /></td>
																	<td><s:property value="#userAccount.userInfoDTO.userName" /></td>
																	<td><s:date name="#userAccount.createTime" format="yyyy-MM-dd"/></td>
																	<s:if test="#userAccount.userAccountIsEnabled==1"><td>启用</td></s:if>
																	<s:else><td>禁用</td></s:else>
																	<s:if test="#userAccount.userAccountNote==null || userAccount.userAccountNote==''"><td>&nbsp;</td></s:if>
																	<s:else><td><s:property value="#userAccount.userAccountNote" /></td></s:else>
																</tr>
															</s:else>
														</s:elseif>
													</s:iterator>
							
												</tbody>
											</table>
										</s:else>	
									</td>
								</tr>
								<tr>
									<td valign="top">
										<span class="detail-feild">角色权限:</span>
									</td>
									<td style="line-height: normal;" valign="top">
										<div id="authSetup"></div>
									</td>
								</tr>
							</tbody>
						</table>
						</s:else>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>